import type { UploadUserFile } from "element-plus";

export interface SpuListParams {
  page: number;
  limit: number;
  category3Id: number;
}

/* 

{
  "records": [
    {
      "id": 6,
      "spuName": "S10 Pro",
      "description": "产品名称\nS10 Pro\n品牌\nvivo\n首销日期\n以官网信息为准\n入网型号\nV2121A\n上市年份\n2021年\n上市月份\n7月",
      // "category3Id": 61,
      // "tmId": 6,
      // "spuSaleAttrList": null,
      // "spuImageList": null,
      // "spuPosterList": null
    }
  ],
  "total": 6,
}
*/

export interface TSpuItem {
  id: number;
  spuName: string;
  description: string;
}
export type SpuList = TSpuItem[];

export interface getSpuListApiRosponse {
  records: SpuList;
  total: number;
}

// 获取基础销售属性列表
export interface BaseSaleAttrListItem {
  id: number;
  name: string;
}
export type BaseSaleAttrList = BaseSaleAttrListItem[];

/*

{
    "spuName": "string",
    tmId:0,
  "category3Id": 0,
  "description": "string",
  "spuImageList": [
    {
      "imgName": "string",
      "imgUrl": "string",
    }
  ],

  ],
  "spuSaleAttrList": [
    {
      "baseSaleAttrId": 0,
      "saleAttrName": "string",
      "spuSaleAttrValueList": [
        {
          "baseSaleAttrId": 0,
          "saleAttrValueName": "string",
        }
      ],
    }
  ],
  "tmId": 0,
}

*/

export interface Spu {
  id?: number;
  category3Id?: number;
  spuName: string;
  tmId: number | undefined;
  description: string;
  spuSaleAttrList: SpuSaleAttrList;
}

// 发送的图片和接口属性不一致
export interface SpuItem extends Spu {
  spuImageList: SpuImageList; //发送请求，接口需要的类型
}

//element-plus 上传图片的
export interface SaveSpuItem extends Spu {
  spuImageList: UploadUserFile[];
}

// 上传图片
export interface SpuImageItem {
  imgName: string;
  imgUrl: string;
}
export type SpuImageList = SpuImageItem[];

// 销售属性
export interface SpuSaleAttrItem {
  baseSaleAttrId: number;
  saleAttrName: string;
  spuSaleAttrValueList: SpuSaleAttrValueList;
  isEdit: boolean;
  id?: number;
}
export type SpuSaleAttrList = SpuSaleAttrItem[];

// 销售属性值
export interface SpuSaleAttrValueListItem {
  baseSaleAttrId: number;
  saleAttrValueName: string;
  id?: number;
}
export type SpuSaleAttrValueList = SpuSaleAttrValueListItem[];

//

// 获取下拉框属性列表
